<template>
  <div class="wether">
    <div class="wether-wrapper">
      <div class="logo">
        <!-- <img src="@/assets/img/wether/cloudy-01.png" alt="" /> -->
      </div>
      <div class="now">
        <div class="place">南昌市</div>
        <div class="temperature">
          {{ today.low }}/{{ today.high }}℃ {{ today.text_day }}
        </div>
        <div class="air">{{ today.humidity }} 相对湿度</div>
      </div>
      <div class="blank"></div>
      <div class="after">
        <div class="wrapper">
          <div class="small-logo">
            <img src="@/assets/img/ming.png" alt="" />
          </div>
          <div class="weekday">{{ tomorrow.text_day }}</div>
          <div class="day">{{ tomorrow.low }}/</div>
          <div class="night">{{ tomorrow.high }}</div>
        </div>
        <div class="wrapper">
          <div class="small-logo">
            <img src="@/assets/img/hou.png" alt="" />
          </div>
          <div class="weekday">{{ acquired.text_day }}</div>
          <div class="day">{{ acquired.low }}/</div>
          <div class="night">{{ acquired.high }}</div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { reactive, toRefs } from '@vue/reactivity';
import { onBeforeMount } from '@vue/runtime-core';
import { useStore } from 'vuex';
export default {
  setup() {
    const state = reactive({
      today: [],
      tomorrow: [],
      acquired: [],
    });
    const store = useStore();
    onBeforeMount(async () => {
      await store.dispatch('_getWether');
      state.today = store.state.wether[0];
      state.tomorrow = store.state.wether[1];
      state.acquired = store.state.wether[2];
    });
    return { ...toRefs(state) };
  },
};
</script>
<style lang="less" scoped>
.wether {
  box-sizing: border-box;
  margin: 0 auto;
  font-family: '黑体';
  background-color: #ffffff;
  width: 95%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wether-wrapper {
  box-sizing: border-box;
  padding: 10px;
  width: 100%;
  display: flex;
  border-radius: 10px;
  box-shadow: 5px 5px 10px #eeeeee, -5px -5px 10px #eeeeee;
  .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 15px;
    img {
      width: 40px;
      height: 40px;
    }
  }
  .blank {
    flex: 1;
  }
  .now {
    .place {
      font-size: 18px;
    }
    .temperature {
      font-size: 17px;
      padding: 3px;
    }
    .air {
      font-size: 12px;
      background: #75afe9;
      border-radius: 2px;
      padding: 2px;
    }
  }
  .after {
    margin-right: 20px;

    .wrapper {
      height: 50%;
      padding: 1px 4px;
      display: flex;
      font-size: 12px;
      line-height: 32px;
      .small-logo {
        display: flex;
        align-items: center;
        justify-content: center;
        img {
          width: 20px;
          height: 20px;
        }
      }
      .weekday {
        flex: 1;
        padding: 0 9px;
        color: #a2a2a2;
      }
      .day {
        color: #a2a2a2;
      }
      .night {
        color: #2c3e50;
      }
    }
  }
}
</style>
